Skip to content

feat(ui): display running version in footer (fixes #629)#1409

Open
opspawn wants to merge 4 commits intokagent-dev:mainfrom
opspawn:fix/629-version-display
Open

feat(ui): display running version in footer (fixes #629)#1409
opspawn wants to merge 4 commits intokagent-dev:mainfrom
opspawn:fix/629-version-display

Conversation

@opspawn
Copy link
Contributor

@opspawn opspawn commented Feb 28, 2026

Summary

  • Display the kagent version in the UI footer next to the kagent logo
  • Version is sourced from NEXT_PUBLIC_KAGENT_VERSION env var, set at Docker build time from the existing VERSION build arg
  • Runtime fallback: if the env var isn't set (e.g. local dev), the footer fetches from the /version backend endpoint
  • Added nginx proxy rule for /version so the endpoint is accessible from the browser in production

How it looks

The footer now shows: v0.5.5 · is an open source project (with the kagent logo)

When version is not available (e.g. local dev without env var and no backend), it gracefully falls back to the original text.

Changes

  • ui/src/components/Footer.tsx — Added version display with env var + API fallback
  • ui/Dockerfile — Pass VERSION build arg as NEXT_PUBLIC_KAGENT_VERSION for Next.js
  • ui/conf/nginx.conf — Proxy /version to backend for runtime access

Test plan

  • npm run build passes
  • Verify version displays correctly with NEXT_PUBLIC_KAGENT_VERSION=0.5.5 npm run dev
  • Verify fallback works when env var is not set but backend is running
  • Verify graceful degradation when neither source is available

Fixes #629


Migrated from #1358 (originally submitted from wrong fork)

jmhbh and others added 4 commits February 28, 2026 07:47
Show the kagent version in the UI footer next to the logo. The version
is sourced from the NEXT_PUBLIC_KAGENT_VERSION environment variable
which is set at build time from the VERSION build arg. As a runtime
fallback, the footer fetches from the /version backend endpoint.

Also adds an nginx proxy rule for the /version endpoint so it is
accessible from the browser in production.

Fixes kagent-dev#629

Signed-off-by: fl-sean03 <sean@opspawn.com>
Signed-off-by: fl-sean03 <jmhbh@users.noreply.github.com>
The VERSION build arg and /version endpoint may already include a 'v'
prefix, which caused the footer to display 'vv0.1.0'. Strip any
leading 'v' before prepending it in the display template.

Signed-off-by: Sean <sean@opspawn.com>
Signed-off-by: fl-sean03 <jmhbh@users.noreply.github.com>
…rror)

Signed-off-by: fl-sean03 <jmhbh@users.noreply.github.com>
Bun v1.3.9 may crash with SIGILL (exit code 132) during process cleanup
after a successful Next.js build. This caused the sqlite E2E CI check to
fail even though the build output was correctly generated.

Capture the bun exit code and verify the build output directory exists.
If bun crashes but the standalone output is present, treat it as success.
Real build failures (missing output) still fail correctly.

Signed-off-by: fl-sean03 <sean@opspawn.com>
Copilot AI review requested due to automatic review settings February 28, 2026 20:07
@opspawn opspawn requested a review from peterj as a code owner February 28, 2026 20:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements feature request #629 to display the running kagent version in the UI footer. The version is baked into the Docker image at build time via the existing VERSION build arg, with a runtime fallback to fetch it from the /version backend endpoint (newly proxied via nginx).

Changes:

  • Added version display logic to the Footer component, including env-var-first resolution with a silent API fallback
  • Threaded NEXT_PUBLIC_KAGENT_VERSION build arg through the Dockerfile builder stage; added a workaround for a known bun segfault on build exit
  • Added nginx proxy rule for /version to route the endpoint from the browser to the backend

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ui/src/components/Footer.tsx Adds "use client" directive, version state + useEffect fallback fetch, and renders version text in footer
ui/Dockerfile Declares VERSION build arg and sets NEXT_PUBLIC_KAGENT_VERSION env var in builder stage; adds bun segfault workaround
ui/conf/nginx.conf Proxies /version requests to the backend (kagent_backend)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +82 to +89
location /version {
proxy_pass http://kagent_backend/version;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using location /version (prefix match) means nginx will also proxy /versions, /version/anything, or any other URI starting with /version to the backend. Since the backend likely has no route for such paths and would return 404, this is low risk, but using location = /version (exact match) — consistent with how the /health check could be written — would be more precise and prevent unexpected requests from reaching the backend. Note that /health has the same issue, so this could be addressed holistically if desired.

Copilot uses AI. Check for mistakes.
&& bun install --frozen-lockfile \
&& bun run build \
&& { bun run build; BUN_EXIT=$?; } \
&& if [ $BUN_EXIT -ne 0 ] && [ ! -d /app/ui/.next/standalone ]; then exit $BUN_EXIT; fi \
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workaround for the known bun segfault bug only checks for directory existence ([ ! -d /app/ui/.next/standalone ]), not whether the build output is complete or valid. A scenario where bun run build exits with a non-zero code (e.g. due to a TypeScript error or OOM) but a partial /app/ui/.next/standalone directory already exists from a previous cached build layer would silently pass, producing a Docker image built from stale artifacts.

Consider also checking for a key file inside the standalone directory, such as server.js, to more reliably distinguish a successful build from a partial/stale one: [ ! -f /app/ui/.next/standalone/server.js ].

Suggested change
&& if [ $BUN_EXIT -ne 0 ] && [ ! -d /app/ui/.next/standalone ]; then exit $BUN_EXIT; fi \
&& if [ "$BUN_EXIT" -ne 0 ] && { [ ! -d /app/ui/.next/standalone ] || [ ! -f /app/ui/.next/standalone/server.js ]; }; then exit "$BUN_EXIT"; fi \

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Display running version in UI

3 participants